Back to Contents        Previous        Next

How it works



By brute force and a lot of ignorance!

A DDL file is a text-file with a mixture of actual text from the source document plus a multitude of coded items each surrounded by curly brackets. The header section of the file - often quite long - contains much coded information carrying the page/frame definitions etc. and most of this is of no interest to an HTML conversion process.
The key aspect from !meDDLe’s viewpoint is that these two types of items - text and codes - are never on the same line in the DDL file. Thus, when some text in the source document has a Style applied to it, the corresponding appearance in the DDL file is, typically, as follows:
{code to start Style}
“text to which Style is applied”
{code to end Style}

i.e all on separate lines in the DDL file.
There is often more than one curly-bracketed code on a line - and often multiple lines of continuous text - but text and codes never mix on any one line.
It is therefore possible to scan a DDL file on a line-by-line basis as the first step to interpreting its contents.

When a DDL file is loaded !meDDLe first opens it and scans through it line-by line until it reaches the Style definitions in the header. It then extracts into arrays each Style name plus the DDL file’s corresponding Style Code. It also makes a note of the file pointer position at the end of these Style definitions - to save some time by not bothering to scan these early lines again when the real processing starts.

Assuming the default settings are used, when the real processing starts - i.e. after a mapping has been confirmed and the output directory is known - !meDDLe scans the DDL document file three times (more or less).
The first scan looks for picture data, which is referenced and its file location noted. The second scan steps to each of the pictures in turn and extracts and converts them as necessary - with each picture being saved into Pics as a separate file. The third scan generates the HTML pages.
For each HTML page in turn, an output HTML file is opened and given a standard HTML heading - incorporating the user-chosen title and background colour instructions. The DDL document file is then examined line-by-line to test whether the line is a text-line or a code-line (and also if the code-line is the start of picture data).

If it is a text-line:
The line is sent to the output file - unless the text is exactly matched by an ‘ignore’ entry. There are also checks to ensure a few HTML reserved characters (e.g. “<”) and ‘entities’ are handled correctly - and in the special cases of the first line of a ‘page’ and user-chosen markers, the text is also stored in arrays for the subsequent construction of the Contents output file.

The current list of reserved/entity characters handled specially by !meDDLe is:
         <
         >
         &
         Double-quotes (ASCII 34)
         Sexed single-quotes (ASCII 144/145)
         Sexed double-quotes (ASCI 148/149)
         Ligatures fi and fl (ASCII 158/159)
         Ellipsis ... (ASCII 140)

If it is a code-line:

!meDDLe tests first for only a few types of DDL code: namely, {tab}, {newpara}, {newpage}, {add/remove a Style} and {embedded picture location}. If any of these are present in the line all codes in that line are checked and appropriate action taken to output corresponding HTML codes to the output file - and sometimes to set flags for subsequent action.
In particular, any DDL Style code will cause the corresponding mapped HTML code to be added to the output file in the right place - except in the case of the Style selected for HTML links (if any) which will be used to insert a live HTML link and any mapping selected for it will be ignored.

In the special case where the code-line is the start of picture data (already extracted in the first scan) the first part of that data is used simply to advance the file pointer to step over this data i.e. to ignore it in this second scan. (Note that the location of embedded pictures is detected and acted upon, to give the correct HTML image tag reference at the right place(s) in the output file(s) so as to match the graphics files in the Pics folder in the output directory, as described earlier in this Manual.)


Depending on the output type selected, the correct end of an HTML output ‘page’ is detected and after adding a standard HTML ending the current output file (an HTML ‘page’) is closed. This continues for as many HTML ‘pages’ as necessaryuntil the end of the DDL document file is reached.

The last HTML ‘page’ is then re-visited to ensure that some of its standard links are appropriate e.g. to delete the link to the ‘Next’ page.

Finally, an HTML Contents file is constructed if the user has chosen this option.





Top of page        Back to Contents        Previous        Next